package cate.game.power;

import cate.game.attr.FightAttr;
import cate.game.attr.PowerAttrPart;
import cate.game.role.Role;
import easy.java.dev.note.NoteClass;

import java.util.HashMap;
import java.util.Map;

@NoteClass("英雄皮肤")
public class HeroSkinPowerFactor {

	private Map<Integer, FightAttr> skinMap = new HashMap<>();

	private FightAttr illustrateAttr;

	public HeroSkinPowerFactor(Role role) {
		if (role == null) {
			return;
		}
		skinMap = role.getShow().heroSkin.getAttrMap();
		illustrateAttr = role.getShow().heroSkin.getIllustrateAttr(role.getGame());
	}

	public PowerAttrPart buildHeroPart(int protoId) {
		PowerAttrPart part = new PowerAttrPart();
		FightAttr attr = skinMap.get(protoId);
		if (attr != null) {
			part.attr.add(attr);
		}
		part.attr.add(illustrateAttr);
		return part;
	}
}
